package component.timeConsumingTask;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * 处理耗时任务，任务无返回值
 */

public class ExecuteTaskCollector {

    static ThreadPoolExecutor mixPool;

    static {
        mixPool = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
    }

    private ExecuteTaskCollector() {

    }

    /**
     * 添加任务
     */
    public static void add(ExecuteTask executeTask) {
        mixPool.submit(() -> {
            //执行任务
            executeTask.execute();
        });
    }

}
